<template>
  <el-dialog :close-on-click-modal="false" :show-close="false" :visible.sync="visible" width="600px">
    <span slot="title">
      <el-steps :active="active" finish-status="success" simple>
        <el-step title="步骤 1" />
        <el-step title="步骤 2" />
      </el-steps>
    </span>

    <!-- 第一步 -->
    <div v-show="active === 0" class="step1">
      <div class="header">使用说明</div>
      <div class="content1 content">
        {{ instructions }}
      </div>

      <div class="header">新建项目名称</div>
      <div class="content2 content">
        <el-input placeholder="项目名称" type="text" />
      </div>

      <div class="header">填写信息</div>
      <div class="content3 content">
        <el-input class="input" placeholder="请输入" type="text" />
        <el-input class="input" placeholder="请输入" type="text" />
      </div>
    </div>

    <!-- 第二步 -->
    <div v-show="active === 1" class="step2">
      <div class="tips">
        由于本次任务包含大量的复杂分析与推理，耗时较长，占用算力资源较大，所以
        <span class="red">请您仔细核对下方所填信息，务必保证准确无误，不遗漏关键信息。</span>
        <br />
        （注意：任务一但中途取消，则只能重新开始）
      </div>

      <div class="header">填写信息</div>
      <div class="content4">
        <div class="item">
          <div class="question">本项目名称？</div>
          <div class="answer">XXXX生产项目</div>
        </div>
        <div class="item">
          <div class="question">本项目所属行业？</div>
          <div class="answer">智能家居行业</div>
        </div>
      </div>
    </div>

    <span slot="footer" class="dialog-footer">
      <span v-show="active === 0">
        <el-button size="mini" @click="cancel">取消</el-button>
        <el-button size="mini" type="primary" @click="save">保存</el-button>
      </span>
      <span v-show="active === 1">
        <el-button size="mini" @click="back">返回</el-button>
        <el-button size="mini" type="primary" @click="confirm">开始</el-button>
      </span>
    </span>
  </el-dialog>
</template>

<script>
  export default {
    name: 'BeforeNewChat',
    data() {
      return {
        visible: false,
        active: 0,
        instructions: '测试内容',
        form: {},
      }
    },
    methods: {
      cancel() {
        // 表单重置业务
        this.hideDialog()
      },
      save() {
        // 表单校验业务
        // if (!) {
        //  return
        // }
        this.active += 1
      },
      back() {
        this.active -= 1
      },
      confirm() {
        this.hideDialog()
        this.$emit('confirm', this.form)
      },
      showDialog() {
        this.visible = true
      },
      hideDialog() {
        this.visible = false
        this.active = 0
      },
    },
  }
</script>

<style scoped lang="scss">
  ::v-deep .el-dialog {
    .el-dialog__header {
      padding: 0;
    }
    .el-dialog__body {
      padding: 20px 40px;
      border-top: none;
      max-height: 500px;
      overflow-y: auto;
    }
    .el-dialog__footer {
      padding: 10px 20px;
      border-top: none;
    }
  }

  .header {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 1px;
    color: black;
    margin: 0 0 15px;
  }

  .content {
    margin: 0 0 30px;
  }

  .content1 {
    font-size: 14px;
    color: black;
    line-height: 20px;
  }

  .content3 .input {
    margin: 0 0 10px;
  }

  .tips {
    font-size: 14px;
    font-weight: 600;
    color: black;
    line-height: 20px;
    margin: 0 0 30px;
    .red {
      color: red;
    }
  }

  .content4 {
    padding-left: 10px;
    .item {
      margin: 0 0 20px;
      .question {
        color: #999999;
        font-size: 14px;
        margin: 0 0 5px;
      }
      .answer {
        color: black;
        font-size: 15px;
      }
    }
  }
</style>
